package com.qidian.mes.md.service.impl;

import com.qidian.mes.md.mapper.MdToolMapper;
import com.qidian.mes.md.mapper.MdWorkToolMapper;
import com.qidian.mes.md.service.MdToolService;
import com.qidian.mes.util.pojo.QdResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author: 小可怎么都睡不够
 * @Description:
 * @Time: 2024-04-11 14:31
 **/
@Service
public class MdToolServiceImpl implements MdToolService {
    @Autowired
    private MdToolMapper mdToolMapper;
    @Autowired
    private MdWorkToolMapper mdWorkToolMapper;

    @Override
    public QdResult getMdToolsByName(String toolName) {
        return QdResult.success(mdToolMapper.getMdToolsByName(toolName));
    }

    @Override
    public QdResult getMdToolsByWorkId(Integer workId) {
        return QdResult.success(mdWorkToolMapper.getWorkTools(workId));
    }

    @Override
    public QdResult insertWorkTools(Integer[] tools, Integer workId) {
        mdWorkToolMapper.deleteWorkTools(workId);
        mdWorkToolMapper.insertWorkTools(tools,workId);
        return QdResult.success();
    }
}
